home *** CD-ROM | disk | FTP | other *** search
- function resetTiles()
- {
- var _loc1_ = this;
- x = 0;
- y = 0;
- while(x < 10)
- {
- while(y < 10)
- {
- duplicateMovieClip("tiles","t" + x + "_" + y,16384 + ++d);
- t = _loc1_["t" + x + "_" + y];
- t._x = x * 28 + 20;
- t._y = y * 28;
- if(y > 5)
- {
- c = int(random(4)) + 1;
- t.col = c;
- t.state = true;
- t.gotoAndStop(c);
- t.x = x;
- t.y = y;
- }
- else
- {
- c = 0;
- t.col = c;
- t.gotoAndStop(5);
- t.x = x;
- t.y = y;
- }
- y++;
- }
- y = 0;
- x++;
- }
- timerID = setInterval(goTime,tc);
- }
- function findTile(x, y)
- {
- var _loc1_ = y;
- var _loc2_ = x;
- var _loc3_ = _root;
- col = _loc3_["t" + _loc2_ + "_" + _loc1_].col;
- if(_loc3_["t" + (_loc2_ - 1) + "_" + _loc1_].col == col or _loc3_["t" + (_loc2_ + 1) + "_" + _loc1_].col == col or _loc3_["t" + _loc2_ + "_" + (_loc1_ - 1)].col == col or _loc3_["t" + _loc2_ + "_" + (_loc1_ + 1)].col == col)
- {
- _loc3_["t" + _loc2_ + "_" + _loc1_].state = false;
- _loc3_["t" + _loc2_ + "_" + _loc1_].gotoAndStop(5);
- sc++;
- tile++;
- if(tile == 20)
- {
- setLevel();
- tile = 0;
- }
- if(_loc3_["t" + (_loc2_ - 1) + "_" + _loc1_].col == col and _loc3_["t" + (_loc2_ - 1) + "_" + _loc1_].state == true)
- {
- findTile(_loc2_ - 1,_loc1_);
- }
- if(_loc3_["t" + (_loc2_ + 1) + "_" + _loc1_].col == col and _loc3_["t" + (_loc2_ + 1) + "_" + _loc1_].state == true)
- {
- findTile(_loc2_ + 1,_loc1_);
- }
- if(_loc3_["t" + _loc2_ + "_" + (_loc1_ - 1)].col == col and _loc3_["t" + _loc2_ + "_" + (_loc1_ - 1)].state == true)
- {
- findTile(_loc2_,_loc1_ - 1);
- }
- if(_loc3_["t" + _loc2_ + "_" + (_loc1_ + 1)].col == col and _loc3_["t" + _loc2_ + "_" + (_loc1_ + 1)].state == true)
- {
- findTile(_loc2_,_loc1_ + 1);
- }
- _loc3_["t" + _loc2_ + "_" + _loc1_].col = 0;
- }
- }
- function checkTile()
- {
- var _loc1_ = _root;
- x = 0;
- y = 0;
- while(x < 10)
- {
- while(y < 9)
- {
- if(_loc1_["t" + x + "_" + (y + 1)].col == 0 and _loc1_["t" + x + "_" + y].col != 0)
- {
- replaceColors(x,y);
- checkTile();
- }
- y++;
- }
- y = 0;
- x++;
- }
- }
- function replaceColors(px, py)
- {
- var _loc1_ = py;
- var _loc2_ = px;
- var _loc3_ = _root;
- c = _loc3_["t" + _loc2_ + "_" + _loc1_].col;
- _loc3_["t" + _loc2_ + "_" + (_loc1_ + 1)].col = c;
- _loc3_["t" + _loc2_ + "_" + (_loc1_ + 1)].state = true;
- _loc3_["t" + _loc2_ + "_" + (_loc1_ + 1)].gotoAndStop(c);
- _loc3_["t" + _loc2_ + "_" + _loc1_].state = false;
- _loc3_["t" + _loc2_ + "_" + _loc1_].col = 0;
- _loc3_["t" + _loc2_ + "_" + _loc1_].gotoAndStop(5);
- }
- function addScore(x, y)
- {
- if(sc > 1)
- {
- textClip.swapDepths(++d);
- textClip._x = x;
- textClip._y = y;
- if(sc < 10)
- {
- score += sc * 100;
- pos = sc * 35;
- textClip.gotoAndPlay(pos);
- clickSound.gotoAndPlay(2);
- }
- else
- {
- score += 2000;
- textClip.gotoAndPlay(350);
- clickSound.gotoAndPlay(5);
- }
- }
- }
- function setLevel()
- {
- level++;
- tc = 30 - level;
- levelUp.gotoAndPlay(2);
- }
- getURL("FSCommand:allowscale",false);
- goTime = function()
- {
- var _loc1_ = _root;
- timer--;
- timerBar._height = timer;
- if(timer < 1)
- {
- x = 0;
- while(x < 10)
- {
- y = 1;
- while(y < 10)
- {
- c = _loc1_["t" + x + "_" + y].col;
- _loc1_["t" + x + "_" + (y - 1)].col = c;
- _loc1_["t" + x + "_" + (y - 1)].state = true;
- _loc1_["t" + x + "_" + (y - 1)].gotoAndStop(c);
- _loc1_["t" + x + "_" + y].state = false;
- _loc1_["t" + x + "_" + y].col = 0;
- _loc1_["t" + x + "_" + y].gotoAndStop(5);
- lineSound.gotoAndPlay(2);
- y++;
- }
- if(_loc1_["t" + x + "_" + 0].col != 0)
- {
- gameOver = true;
- }
- x++;
- }
- y = 9;
- x = 0;
- while(x < 10)
- {
- c = int(random(4)) + 1;
- _loc1_["t" + x + "_" + y].col = c;
- _loc1_["t" + x + "_" + y].state = true;
- _loc1_["t" + x + "_" + y].gotoAndStop(c);
- x++;
- }
- if(gameOver == true)
- {
- clearInterval(timerID);
- x = 0;
- while(x < 10)
- {
- y = 0;
- while(y < 10)
- {
- removeMovieClip(_loc1_["t" + x + "_" + y]);
- gameOverClip.gotoAndPlay(2);
- y++;
- }
- x++;
- }
- }
- else
- {
- clearInterval(timerID);
- timerBar._height = tm;
- timer = tm;
- timerID = setInterval(goTime,tc);
- }
- }
- };
- playing = 1;
- level = 1;
- tile = 0;
- tc = 30;
- d = 0;
- sc = 0;
- score = 0;
- timer = tm = 204;
- gameOver = false;
- resetTiles();
- stop();
-